<?php
if ( function_exists('register_sidebar') )
    register_sidebar();

$SilasConfig = array();
$SilasConfig['mailValidEmails'] = array( // can only send to these valid emails
    'joetan54@gmail.com',
        );
$SilasConfig['hideSidebar'] = false;

/*
// Amazon Alexa
require_once('lib.thumbnails.php');
$options = get_option('tantan_wordpress_s3');

$urls = array();
foreach ($links as $link) {
	$urls[] = $link->link_url;
}
$default_image = 'http://tantannoodles.com/wp-content/themes/tantan/images/icons/cube.gif';
//$thumbnails = get_thumbnail_links($options['key'], $options['secret'], 'Small', $default_image, $urls);
*/

function makeThumbnail($url, $size='S') {
	require_once(dirname(__FILE__).'/../../../wp-includes/class-snoopy.php');
	$dir = dirname(__FILE__).'/../../../cache/';
	$parts = parse_url($url);
	$hash = md5($url);
	$filename = $parts['host'].'-'.$hash.'.jpg';
	if (!file_exists($dir.$filename) || (time() - filemtime($dir.$filename) > 86400*2) ) {
		if (is_writable($dir.$filename)) {
			$snoopy = new Snoopy();
			$url = 'http://images.websnapr.com/?key=08m4SFuBa7pQ&size='.urlencode($size).'&url='. urlencode($url);
			$snoopy->fetch($url);
			file_put_contents($dir.$filename, $snoopy->results);
		}
	} 
	
	return '/cache/'.$filename;
}
?>
